<template>
	<view class="container" style="width: 702rpx;">
		<view class="top">
			<view class="container" @click="goShopList()">
				<text class="title">
					今日营业额(元)
				</text>
				<text class="money">
					{{shopInfo.TdTurnover ||0.00}}
				</text>
			</view>
			<view class="container" @click="toPage('/pages/otherPage/orderList')" v-if="shopInfo.Type=='Business'">
				<text class="title">
					今日订单
				</text>
				<text class="money" style="color: red;">
					{{shopInfo.TdNOrder ||0.00}}
				</text>
			</view>
			<view class="container" @click="toPage('/pages/otherPage/cir_commis')">
				<text class="title">
					余额
				</text>
				<text class="money" style="color: orange;">
					{{ shopInfo.Balance||0.00}}
				</text>
			</view>
		</view>

		<view class="data" v-if="shopInfo.Type=='Agent'">
			<!-- <view class="data_item">
				<text class="title">今日订单</text>
				<text>{{shopInfo.TdNOrder || 0}}</text>
			</view> -->
			<view class="data_item" v-if="shopInfo.Type=='Agent'" @click="toPage('/pages/otherPage/merchantManagement')">
				<text class="title">商家</text>
				<text>{{shopInfo.TdRecharge ||0 }}</text>
			</view>
			<view class="data_item" v-if="shopInfo.Type=='Agent'" @click="toPage('/pages/otherPage/accountManagement')">
				<text class="title">账号</text>
				<text>{{shopInfo.TdNMbr || 0}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "businessData",
		props: {
			shopInfo: {
				default: {
					TdTurnover: '0.00',
					TdNOrder: 0
				},
				typeof: Object
			},
		},
		watch: {
			async shopInfo(newValue) {
				console.log('店铺信息', newValue);
				// let res=await this.$api.post('RevenueRecords/GetAgentIncome',{ID:newValue.ID})
				// console.log(res);
			}
		},
		data() {
			return {

			};
		},
		methods: {
			goShopList(){
				let url =this.shopInfo.Type=='Business'?'/pages/otherPage/incomeDetails': '/pages/otherPage/divideInto'
				this.toPage(url)

			},
			toPage(path) {
				uni.navigateTo({
					url: `${path}?ShopID=${this.shopInfo.ShopID}&ID=${this.shopInfo.ID}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.top {
		display: flex;
		justify-content: space-around;
		width: 100%;
	}

	.data {
		width: 654rpx;
		height: 126rpx;
		background: #FAFAFA;
		border-radius: 8rpx;
		margin: 0 auto;
		box-sizing: border-box;
		padding: 20rpx 40rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;
		margin-top: 20rpx;

		.data_item {
			height: 100%;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			align-items: center;

			.title {
				font-size: 24rpx;
				color: #666666;
			}
		}
	}

	.money {
		font-weight: bold;
		font-size: 56rpx;
		color: #3572FE;
		// margin-bottom: 24rpx;
	}

	.title {
		font-size: 24rpx;
		color: #666666;
		margin-bottom: 8rpx;
	}

	.container {
		// width: 702rpx;
		// height: 328rpx;
		align-items: center;
		background: #FFFFFF;
		border-radius: 24rpx;
		box-sizing: border-box;
		padding: 32rpx;
		display: flex;
		flex-direction: column;
		margin: 0 auto;
	}
</style>